@extends('admin::layouts.master')

@section('content')
    <div class="col-lg-12">
        <div class="card card-table">
            <div class="card-header">
                分类管理
                <div class="mt-2">
                    <a href="{{route('category.index')}}" class="btn btn-primary mr-2">分类列表</a>
                    <a href="#" class="btn btn-space btn-primary mt-1">
                        编辑分类
                    </a>
                </div>
            </div>
            <div class="card-body">
                <form action="{{route('category.update',$category['id'])}}" method="post">
                    @csrf
                    @method('PUT')
                    <div class="col-lg-12">
                        <div class="card-body">
                            <div class="form-group">
                                <label>分类名称</label>
                                <input type="text" value="{{$category['cname']}}" name="cname" class="form-control">
                            </div>
                            <div class="form-group">
                                <label>父级分类</label>
                                <div class="col-12 col-sm-8 col-lg-12">
                                    <select class="form-control" name="pid">
                                        <option value="0" selected="" >顶级分类</option>
                                        @foreach($categorys as $v)
                                            <option value="{{$v['id']}}" {{$v['_selected'] ? 'selected' : ''}} {{$v['_disabled'] ? 'disabled' : ''}}>{!! $v['_cname'] !!}</option>
                                        @endforeach
                                    </select>
                                </div>
                            </div>
                            <div class="row pt-3">
                                <div class="col-sm-6">
                                    <p class="text-right">
                                        <button type="submit" class="btn btn-space btn-primary ">保存数据</button>
                                    </p>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
@stop
